#pragma once
#include "QueryRetrieveSCU.h"
#include "CPacsSetUI.h"

class CQrSearchUI : public WindowImplBase, public IListCallbackUI
{
public:
	CQrSearchUI(HWND hParent = NULL, HWND hOwner = NULL, BOOL bSelfDel = FALSE);
	~CQrSearchUI();

	void RefreshList();

public:
	LPCTSTR GetWindowClassName() const;

	virtual void OnFinalMessage(HWND hWnd);

	virtual void InitWindow();

	//virtual LRESULT ResponseDefaultKeyEvent(WPARAM wParam);

	virtual DString GetSkinFile();

	virtual DString GetSkinFolder();

	virtual CControlUI* CreateControl(LPCTSTR pstrClass);

	virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);

	virtual LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);

	virtual LPCTSTR GetItemText(CControlUI* pControl, int iIndex, int iSubItem);

private:

	BOOL m_bSelfDel;
	HWND m_hOwner;
	CDicomServer m_storeSCP;
	CQueryRetrieveSCU m_qrScu;
	QrConfig m_qrcfg;
	vector<FindItem> m_findList;

	CComboUI* m_cmbServer;
	CComboUI* m_cmbModality;
	CComboUI* m_cmbDate;
	CComboUI* m_cmbCond;
	CDateTimeUI* m_dtStart;
	CDateTimeUI* m_dtEnd;
	CListUI* m_list;


	void ApplyConfig(const QrConfig& cfg);

protected:
	void Notify(TNotifyUI& msg);
	void OnPrepare(TNotifyUI& msg);
	void OnExit(TNotifyUI& msg);

	void OnBtnSearch();
};

